﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace S.PurchaseAndSales.Comain.Migrations
{
    public partial class addPurchaseAndSales : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CustomerInformation",
                columns: table => new
                {
                    CustomerInformationId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CustomerType = table.Column<int>(type: "int", nullable: false),
                    ChargePersonPhone = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ChargePersonName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CustomerName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    IdentityCard = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    location = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Industry = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    SocialCreditCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    MnemonicCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CollectionFile = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CustomerStage = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CustomLabel = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    IntendedProduct = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CooperationDate = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    AffiliatedUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    UseCondition = table.Column<int>(type: "int", nullable: false),
                    SuperiorCustomer = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CustomerLevel = table.Column<int>(type: "int", nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    Market = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    Salesman = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
                    CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CustomerInformation", x => x.CustomerInformationId);
                });

            migrationBuilder.CreateTable(
                name: "PersonalSaleModels",
                columns: table => new
                {
                    PersonalSaleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SaleDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DocumentNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Client = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    OnlyNumber = table.Column<int>(type: "int", nullable: false),
                    ClosingPrice = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    AuditStatus = table.Column<int>(type: "int", nullable: false),
                    Section = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    DeliveryAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Salesman = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Auditor = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    AuditTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    FinancialAuditor = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    FinancialAuditTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    WarehouseAuditor = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    WarehouseAuditTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PersonalSaleModels", x => x.PersonalSaleId);
                });

            migrationBuilder.CreateTable(
                name: "PurchaseFormModels",
                columns: table => new
                {
                    PurchaseFormId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BatchEarHorns = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    SheepRescissionId = table.Column<int>(type: "int", nullable: false),
                    ColumnManagementId = table.Column<int>(type: "int", nullable: true),
                    Gender = table.Column<bool>(type: "bit", nullable: true),
                    GoodName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    LabelPackage = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UnitOfMeasure = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    InboundQuantity = table.Column<int>(type: "int", nullable: false),
                    AverageUnitOnly = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    Amount = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
                    UnitDiscounts = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    AdjustTheAmount = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
                    SettlementAmount = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    TotalWeight = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
                    PurchaseFormDesc = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                    SummaryEnum = table.Column<int>(type: "int", nullable: false),
                    TheDocumentNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    Warehouse = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDel = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PurchaseFormModels", x => x.PurchaseFormId);
                });

            migrationBuilder.CreateTable(
                name: "SheepSaleModels",
                columns: table => new
                {
                    SheepSaleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SheepFileId = table.Column<int>(type: "int", nullable: false),
                    MarkId = table.Column<int>(type: "int", nullable: false),
                    ElectronicEarTags = table.Column<int>(type: "int", maxLength: 50, nullable: true),
                    SaleDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ClosingPrice = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    FixPrice = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    DiscountRatio = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    Grade = table.Column<int>(type: "int", maxLength: 50, nullable: false),
                    OfficialRank = table.Column<int>(type: "int", nullable: false),
                    SheepSex = table.Column<bool>(type: "bit", nullable: false),
                    SheepType = table.Column<int>(type: "int", nullable: false),
                    ReproductiveState = table.Column<int>(type: "int", nullable: false),
                    CurrentBuilding = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CurrentField = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    BirthDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    BirthWeight = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    WeaningWeight = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
                    FatherSign = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    MotherSign = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    MonthsAge = table.Column<int>(type: "int", nullable: false),
                    CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SheepSaleModels", x => x.SheepSaleId);
                });

            migrationBuilder.CreateTable(
                name: "VendorModels",
                columns: table => new
                {
                    VendorSnowId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    VendorType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ResponsiblePhone = table.Column<string>(type: "nvarchar(11)", maxLength: 11, nullable: false),
                    ResponsibleName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    VendorName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    IdentityCard = table.Column<string>(type: "nvarchar(18)", maxLength: 18, nullable: true),
                    ProvinceId = table.Column<int>(type: "int", nullable: false),
                    CityId = table.Column<int>(type: "int", nullable: false),
                    AreaId = table.Column<int>(type: "int", nullable: false),
                    IndustryName = table.Column<bool>(type: "bit", maxLength: 50, nullable: false),
                    UnifiedSocialCreditCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Mnemonics = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    VendorAttributes = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    BusinessId = table.Column<int>(type: "int", nullable: true),
                    UseState = table.Column<bool>(type: "bit", nullable: false),
                    UnitsOfReference = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    VendorDesc = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
                    Markets = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Salesman = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDel = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VendorModels", x => x.VendorSnowId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "CustomerInformation");

            migrationBuilder.DropTable(
                name: "PersonalSaleModels");

            migrationBuilder.DropTable(
                name: "PurchaseFormModels");

            migrationBuilder.DropTable(
                name: "SheepSaleModels");

            migrationBuilder.DropTable(
                name: "VendorModels");
        }
    }
}
